Consumer Finance Complaints Analyzing and Modeling (using Keras Text Classification)

In this article, we use the Consumer Complaint Database published by Consumer Financial Protection Bureau.

Data Description

According to Kaggle page ofd Consumer Financial Protection Bureau (CFPB), Each week the CFPB sends thousands of consumers’ complaints about financial products and services to companies for response. Those complaints are published here after the company responds or after 15 days, whichever comes first. By adding their voice, consumers help improve the financial marketplace.

Data Analysis

Consumer Complaints by Date Received

As can be seen, the number of complaints has been increasing overall.

Consumer Complaints by Product

Consumer Complaints by State

The top ten states with the highest numbers of complaints can be found in the following table.

Complain Sent to Companies

Disputed Complains

Problem Description

The object of the exercise here is to link the narrative of a complaint with the product. For this reason, we would like to use a form of text processing and combine Keras artificial neural network (ANN) for creating a predictive model.

Modeling

However, we need to focus only on Consumer complaint narrative and Product features. Therefore,

First, we need to do text tokenization. This can be done using Keras preprocessing text tokenizer.

Moreover, categorical variables can be converted into indicator variables using tf.keras.utils.to_categorical.

For this study, we use the Sequential model, which is a linear stack of layers.

Testing the results.